package com.hj.api.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.ServletRequest;
import java.util.Enumeration;

public class HttpUtils {


    public static String getPara(ServletRequest request) {

        Enumeration paramNames = request.getParameterNames();
        String para = "";
        while(paramNames != null && paramNames.hasMoreElements()) {
            String paramName = (String)paramNames.nextElement();
            String[] values = request.getParameterValues(paramName);
            if (values != null && values.length != 0) {

                String val = "";
                val = values[0];
                if (StringUtils.isBlank(para)) {
                    para = paramName + "=" + val;
                } else {
                    para = para+"&"+paramName + "=" + val;
                }

            }

        }
        return para;
    }

}
